package com.hp.springaop01;

import org.aspectj.lang.ProceedingJoinPoint;
import org.springframework.stereotype.Component;

/**
 * 公安局
 */
@Component
public class PoliceStation {

    public void watch(){
        System.out.println("警察叔叔正在监视你！！");
    }

    public void after(){
        System.out.println("警察叔叔跟你拜拜！！");
    }

    public void around(ProceedingJoinPoint joinPoint) throws Throwable {
        System.out.println("警察叔叔在你前面开路！！");
        //执行原来的方法
        joinPoint.proceed();
        System.out.println("警察叔叔在你后面保护！！");
    }

    public void afterThrow(Throwable throwable){
        System.out.println("警察叔叔发现异常情况！！"+throwable.getMessage());
    }

    public void afterReturn(){
        System.out.println("警察叔叔回去了！！");
    }
}
